<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Index</title>
</head>

<body>
    <h1>Hello, Index</h1>
    <img src="./3rd.png" />
    <script>
        fetch('/api/userList').then(res => {
            return res.json();
        }).then(res => {
            console.log(res);
            res.userList.forEach(element => {
                let newDiv = document.createElement('div')
                newDiv.innerHTML = element.username + "的性别是" + element.sex
                document.body.appendChild(newDiv)
            });
        })
    </script>
</body>

</html>